package com.googlecode.ddlutilstool.common;

/**
 * <p>The Driver describes a JDBC driver.
 * This class is simply a data structure
 * that providing a name to a valid
 * JDBC driver</p>
 *  
 * @author critchie
 *
 */
public class DriverBean {

	private String name;
	private String classname;
	private String urlHint;
	
	/**
	 * @return the display name
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * @param name The display name
	 */
	public void setName(String name) {
		this.name = name;
	}
	
	/**
	 * @return The jdbc driver class
	 */
	public String getClassname() {
		return classname;
	}
	
	/**
	 * @param classname The jdbc driver class
	 */
	public void setClassname(String classname) {
		this.classname = classname;
	}
	
	/**
	 * @return a useful example of a URL
	 */
	public String getUrlHint() {
		return urlHint;
	}
	
	/**
	 * @param urlHint a useful example of a URL
	 */
	public void setUrlHint(String urlHint) {
		this.urlHint = urlHint;
	}
	
	
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof DriverBean) {
			DriverBean other = (DriverBean)obj;
			return equals(classname,other.classname) 
			&& equals(name,other.name)
			&& equals(urlHint,other.urlHint);
		}
		else {
			return false;
		}
	}

	private boolean equals(Object o1, Object o2) {
		return (o1==null && o2==null) || (o1!=null && o2!=null && o1.equals(o2));
	}
}
